const path = require('path');
const RunPlugin = require('./plugins/run-plugin');
const DonePlugin = require('./plugins/done-plugin');
module.exports = {
    mode: 'development',
    devtool: false,
    // 入口的2种写法
    // 1-单入口 是一种语法糖 会被 webpack 转化为 { main: "./src/index.js" }
    // entry: "./src/index.js",
    // 多入口
    // entry: {
    //     home: "./src/home.js",
    //     about: "./src/about.js",
    // },
    entry: {
        entry1: './src/entry1.js',
        entry2: './src/entry2.js',
    },
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: '[name].js'
    },
    resolve: {
        extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
    },
    plugins: [
        new RunPlugin(),
        new DonePlugin(),
    ],
    module: {
        rules: [
            {
                test: /\.js$/,
                // 从下往上 从右向左执行
                use: [
                    path.resolve(__dirname, 'loaders/logger2.js'),
                    path.resolve(__dirname, 'loaders/logger1.js'),
                ]
            }
        ]
    }
}